package com.lbs.jiepiaisi.bean;

import org.json.JSONArray;

/**
 *
 * 时间：2017/6/28 13:46
 * 作用：目录节点实体类
 */

public class CarTreeText {

    private JSONArray childJsonArray;

    public JSONArray getChildJsonArray() {
        return childJsonArray;
    }
    public void setChildJsonArray(JSONArray childJsonArray) {
        this.childJsonArray = childJsonArray;
    }
    /**
     * 是否是具体的车辆,默认都不是
     */
    private boolean isCar;
    /**
     * 菜单编号
     */
    private String id;
    /**
     * 菜单内容
     */
    private String text;
    /**
     * 父节点id
     */
    private String parentId;
    /**
     * 是否有子节点
     */
    private boolean hasChild;
    /**
     * 层级
     */
    private int level;
    /**
     * 是否展开
     */
    private boolean expanded;
    /**
     * 节点编码
     */
    private String deptNum;
    /**
     * 节点类型
     */
    private int deptType;

    public CarTreeText() {
        super();
    }
    /**
     *
     * @param id       菜单编号
     * @param text     菜单显示内容
     * @param parentId 父节点id
     * @param hasChild 是否有子节点
     * @param level    层级
     * @param expanded 展开状态
     * @param deptType 节点类型
     * @param deptNum  节点编码
     */
    public CarTreeText(String id, String text, String parentId, boolean hasChild, int level, boolean expanded, int deptType, String deptNum) {
        super();
        this.id = id;
        this.text = text;
        this.parentId = parentId;
        this.hasChild = hasChild;
        this.level = level;
        this.expanded = expanded;
        this.deptNum = deptNum;
        this.deptType = deptType;
        this.isCar = false;
    }

    /**
     *
     * @param id       菜单编号
     * @param text     菜单显示内容
     * @param parentId 父节点id
     * @param hasChild 是否有子节点
     * @param level    层级
     * @param deptType 节点类型
     * @param deptNum  节点编码
     */
    public CarTreeText(String id, String text, String parentId, boolean hasChild, int level, int deptType, String deptNum) {
        super();
        this.id = id;
        this.text = text;
        this.parentId = parentId;
        this.hasChild = hasChild;
        this.level = level;
        this.expanded = false;
        this.deptNum = deptNum;
        this.deptType = deptType;
        this.isCar = false;
    }
    public String getDeptNum() {
        return deptNum;
    }

    public void setDeptNum(String deptNum) {
        this.deptNum = deptNum;
    }

    public int getDeptType() {
        return deptType;
    }

    public void setDeptType(int deptType) {
        this.deptType = deptType;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public boolean isHasChild() {
        return hasChild;
    }

    public void setHasChild(boolean hasChild) {
        this.hasChild = hasChild;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public boolean isExpanded() {
        return expanded;
    }

    public void setExpanded(boolean expanded) {
        this.expanded = expanded;
    }

    public boolean isCar() {
        return isCar;
    }

    public void setIsCar(boolean isCar) {
        this.isCar = isCar;
    }
    @Override
    public String toString() {
        return "CarTreeText{" +
                "id='" + id + '\'' +
                ", text='" + text + '\'' +
                ", parentId='" + parentId + '\'' +
                ", hasChild=" + hasChild +
                ", level=" + level +
                ", expanded=" + expanded +
                ", deptNum='" + deptNum + '\'' +
                ", deptType=" + deptType +
                '}';
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CarTreeText that = (CarTreeText) o;

        if (isCar != that.isCar) return false;
        if (hasChild != that.hasChild) return false;
        if (level != that.level) return false;
        if (expanded != that.expanded) return false;
        if (deptType != that.deptType) return false;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (text != null ? !text.equals(that.text) : that.text != null) return false;
        if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null)
            return false;
        return !(deptNum != null ? !deptNum.equals(that.deptNum) : that.deptNum != null);

    }
    @Override
    public int hashCode() {
        int result = (isCar ? 1 : 0);
        result = 31 * result + (id != null ? id.hashCode() : 0);
        result = 31 * result + (text != null ? text.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (hasChild ? 1 : 0);
        result = 31 * result + level;
        result = 31 * result + (expanded ? 1 : 0);
        result = 31 * result + (deptNum != null ? deptNum.hashCode() : 0);
        result = 31 * result + deptType;
        return result;
    }

}
